package org.example.guide.persistence;

import org.apache.ibatis.annotations.*;
import org.example.guide.domain.Guide;
import org.springframework.stereotype.Repository;

import java.util.List;

@Mapper
@Repository
public interface guideMapper {
    @Select("SELECT * FROM guidemsg")
    List<Guide> selectAll();

    @Select("SELECT * FROM guidemsg WHERE guidemsg.name LIKE CONCAT('%', #{name}, '%')")
    List<Guide> selectByName(String name);

    @Delete("DELETE FROM guidemsg WHERE guidemsg.id = #{id}")
    int deleteById(@Param("id") int id);

    @Insert("INSERT INTO guidemsg (id,name,Age,Gender,PhoneNumber,Email,Qualification,Status,TeamID,score) VALUES (#{id},#{name}, #{Age}, #{Gender}, #{PhoneNumber},#{Email},#{Qualification},#{Status},#{TeamID},#{score})")
    void insert(int id, String name, int Age, String Gender, String PhoneNumber, String Email, String Qualification,String Status,int TeamID,String score);

    @Update("UPDATE guidemsg SET name = #{name}, Age = #{Age}, Gender = #{Gender}, PhoneNumber = #{PhoneNumber},Email = #{Email}," +
            "Qualification = #{Qualification},Status = #{Status},TeamID = #{TeamID} WHERE id = #{id}")
    void update(int id, String name, int Age, String Gender, String PhoneNumber, String Email, String Qualification,String Status,int TeamID);
    @Update("update guidemsg set score=#{score} where id=#{id}")
    void updateScore(@Param("id") int id,@Param("score")String score);
}
